<?php

namespace app\common\models;

use Yii;

/**
 * This is the model class for table "balance_log".
 *
 * @property int $id
 * @property int $mch_id 商户id
 * @property int $member_id
 * @property string $balance 增加或减少的钱
 * @property int $balance_id 账本标识
 * @property int $balance_type 账本类型
 * @property int $source_type //来源类型 1,会员转帐 2交易卖出,3交易买入 4兑换
 * @property int $log_type 日志类型（增加1、减少0）
 * @property int $source_id 如果来源为订单，即为订单id,如果来源为分红，则为分红日志id
 * @property string $old_balance 上次金额
 * @property string $note 备注
 * @property string $bonus_from 分红的来源
 * @property int $create_time 时间
 */
class BalanceLog extends \yii\db\ActiveRecord
{
    /**
     * {@inheritdoc}
     */
    public static function tableName()
    {
        return 'balance_log';
    }

    /**
     * {@inheritdoc}
     */
    public function rules()
    {
        return [
            [['mch_id', 'member_id', 'balance_id', 'balance_type', 'source_type', 'log_type', 'source_id', 'create_time'], 'integer'],
            [['balance', 'old_balance'], 'number'],
            [['note'], 'string'],
            [['bonus_from'], 'string', 'max' => 64],
        ];
    }

    /**
     * {@inheritdoc}
     */
    public function attributeLabels()
    {
        return [
            'id' => 'ID',
            'mch_id' => 'Mch ID',
            'member_id' => 'Member ID',
            'balance' => 'Balance',
            'balance_id' => 'Balance ID',
            'balance_type' => 'Balance Type',
            'source_type' => 'Source Type',
            'log_type' => 'Log Type',
            'source_id' => 'Source ID',
            'old_balance' => 'Old Balance',
            'note' => 'Note',
            'bonus_from' => 'Bonus From',
            'create_time' => 'Create Time',
        ];
    }
}
